]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
remoteSearch: Parse 'DesktopId' field in key file
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 22 Jun 2012 15:44:15 +0000 (17:44 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 25 Jun 2012 20:57:31 +0000 (22:57 +0200)
We strongly expect applications to use the same values for the
'Title'/'Icon' fields in their search provider .ini file as the
'Name'/'Icon' fields in their .desktop file. Rather than requiring
applications to duplicate those fields, allow them to specify a
'DesktopId' field instead to point to the corresponding .desktop
file, which makes it possible to ship search provider files without
translatable strings (which is nice given that merging translations
into search provider files lacks a standard rule).

https://bugzilla.gnome.org/show_bug.cgi?id=678816

js/ui/remoteSearch.js

index 6a03607ee43ae9f131e3afd32213b00ad5e5527d..bf391d24cb633b3c6f1647e80657b4065ccc31e9 100644 (file)
@@ -62,12 +62,26 @@ function loadRemoteSearchProvidersFromDir(dir, addProviderCallback) {
             let remoteProvider, title;
             try {
                 let group = KEY_FILE_GROUP;
-                let iconName = keyfile.get_string(group, 'Icon');
                 let busName = keyfile.get_string(group, 'BusName');
                 let objectPath = keyfile.get_string(group, 'ObjectPath');
-                title = keyfile.get_locale_string(group, 'Title', null);
 
-                let icon = new Gio.ThemedIcon({ name: iconName });
+                let appInfo = null;
+                try {
+                    let desktopId = keyfile.get_string(group, 'DesktopId');
+                    appInfo = Gio.DesktopAppInfo.new(desktopId);
+                } catch (e) {
+                }
+
+                let icon;
+                if (appInfo) {
+                    icon = appInfo.get_icon();
+                    title = appInfo.get_name();
+                } else {
+                    let iconName = keyfile.get_string(group, 'Icon');
+                    icon = new Gio.ThemedIcon({ name: iconName });
+                    title = keyfile.get_locale_string(group, 'Title', null);
+                }
+
                 remoteProvider = new RemoteSearchProvider(title,
                                                           icon,
                                                           busName,